home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 September / PCWorld_2008-09_cd.bin / v cisle / sadanastroju / IE7proSetup_2.3.exe / userscripts / GoogleBlogSearch.ieuser.js < prev    next >
Text File  |  2007-11-20  |  1KB  |  35 lines

  1. // Google Blogsearch 0.5
  2. // (c) 2005-2006, Clem
  3. // To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
  4. // --------------------------------------------------------------------
  5. // ==UserScript==
  6. // @name          Google Blogsearch
  7. // @namespace     http://labs.beffa.org/greasemonkey/
  8. // @description   Add google blogsearch to the default google interface
  9. // @include       http://*.google.*/*
  10. // ==/UserScript==
  11.  
  12. (function() {    
  13.       blog = document.createElement('span');
  14.       if(document.location.href.match(/\/blogsearch/))
  15.         blog.innerHTML = '<b>Blog</b>    '
  16.       else
  17.         blog.innerHTML = '<a class=q href="http://www.google.com/blogsearch?" onClick="return qs(this);">Blog</a>    '
  18.  
  19.       //search web or image node (first search link)
  20.       node = null; 
  21.       alla = document.getElementsByTagName('a'); 
  22.       for(var i=0;i<alla.length;i++) { if(alla[i].className == 'q') { node = alla[i]; break; } }
  23.       if (node != null) {
  24.             if (node.childNodes[0].data == "Web")
  25.                 node.parentNode.insertBefore(blog,node.nextSibling.nextSibling);
  26.             else
  27.                 node.parentNode.insertBefore(blog,node);
  28.       } else {
  29.             //for google video
  30.             node = document.getElementById("t0a");
  31.             if (node != null) 
  32.                 node.parentNode.insertBefore(blog,node.nextSibling.nextSibling);
  33.       }
  34. })();
  35.